<template>
  <el-container class="layout-container-demo" style="height: 100vh">
    <el-main>
      <el-scrollbar>
        <el-table :data="tableData">
          <el-table-column prop="id" label="店铺编号" />
          <el-table-column prop="name" label="店铺" />
          <el-table-column prop="securityFund" label="保障金" />
          <!-- <el-table-column prop="score" label="评分"> -->
          <el-table-column label="评分">
            <template #default="scope">
              <el-rate v-model="scope.row.score" disabled show-score text-color="#ff9900">
                {{ scope.row.score }} 分
              </el-rate>
            </template>
          </el-table-column>
          <el-table-column label="操作">
            <template #default="scope">
              <el-button @click="toCommodityVue(scope.row.id)">
                查看店铺商品
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-scrollbar>
    </el-main>
  </el-container>
</template>
  
<script lang="ts" setup>
import { ref } from 'vue'
import { getAllShop } from "../../api/shop/"
import { useRouter } from 'vue-router'
const router = useRouter()

const allShop = getAllShop({})
let tableData = ref([])
allShop.then((res) => {
  if (res.code === 200) {
    tableData.value = res.data
  }
})

type Item = {
  shopId: number
}
const toCommodityVue = (shopId: number) => {
  const item: Item = { shopId: shopId };
  router.push({
    path: "/UserOperate/Commodity",
    query: item
  })
}


</script>
  
<style scoped></style>
  